package com.twang.stock.task;

import com.twang.stock.task.old.BaseTask;
import com.twang.stock.threadPool.AsycTaskExecutorConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;

/**
 * 通知个股买点:http://127.0.0.1/utils/notifyStockBuyTask
 */

@Service
@Slf4j
public class NotifyZuoTiTask extends BaseTask {

    @Autowired
    private NotifyStockBuyTask notifyStockBuyTask;

    @Autowired
    private AsycTaskExecutorConfig asycTaskExecutorConfig;

    @Scheduled(cron = "0/10 * * * * ?")
    public void execute() throws Exception {
        if (!isWorkTradeTime()) {
            return;
        }

        asycTaskExecutorConfig.taskQueueExecutor().execute(() -> {
            try {
                notifyStockBuyTask.extracted();
            } catch (Exception e) {
                log.info("error = {}", e);
            }
            log.info("==========> 做T预警  NotifyZuoTiTask end!");
        });
    }




}
